package cn.six.dosomething408.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        // 允许所有来源的请求
        registry.addMapping("/**").allowedOrigins("*");
        // 或者，你可以指定具体的域名
        // registry.addMapping("/**").allowedOrigins("http://example.com");
    }
}
